UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zhWya1WtGXXlhYKdDBYjKZ7X8i2NwpIsS7ExQj8D12Y='
WHERE
key_id = 'e3201f9e4177a12bb9487c4ec973f2be9e2d64986f237b5004022e28810102e9'
AND (
token = 'zhWya1WtGXXlhYKdDBYjKZ7X8i2NwpIsS7ExQj8D12Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)