UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PH9aTETW+6WXDTXQEC0GH6nDxKHkyquxHzKMVINYUMc='
WHERE
key_id = '0fbb9648bc8fc0d9e9d5bb0015a943726701371f050c636c285dfc64c889b831'
AND (
token = 'PH9aTETW+6WXDTXQEC0GH6nDxKHkyquxHzKMVINYUMc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)