UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8RHZENNRne1pHyuju4j5PCcn6b37Oy7feFHOucEt94A='
WHERE
key_id = '1e799cc4f0bc4ed48b0523e217ef17371cc3735d476325d3c96498380ad8fcad'
AND (
token = '8RHZENNRne1pHyuju4j5PCcn6b37Oy7feFHOucEt94A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)