UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e7qMYV9zv97bt8TrpWiTtmrJgOXVCzJ0WS3tDXBdiT0='
WHERE
key_id = '580151bf8867b0f4ffbfd3dd42685d906a5bdb9a8f395a76b666e4065ec829a3'
AND (
token = 'e7qMYV9zv97bt8TrpWiTtmrJgOXVCzJ0WS3tDXBdiT0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)