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