UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4X4uhZaPAQoXEpRgPUw8fuAVhgRdG0MrgOOPvOuzt0Q='
WHERE
key_id = '30a9f5caee7a0b8872c0e5859cd9b8e2b8d6e908f11f9133ef37412a8fe8806a'
AND (
token = '4X4uhZaPAQoXEpRgPUw8fuAVhgRdG0MrgOOPvOuzt0Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)