UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EJsaTiWVbi75QKJ6Ckq2Vztat3MyhuULLDm9eY5hhug='
WHERE
key_id = '6d7dd7da4b57211667e55d309effc72a5c9c814baa050bc36259fdc38a4d0a32'
AND (
token = 'EJsaTiWVbi75QKJ6Ckq2Vztat3MyhuULLDm9eY5hhug='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)