UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HI8ACZNuX31btgWJQfE3BCXIoJ3oc48SyMU7uviR3tQ='
WHERE
key_id = '7e8ebaf53c83fc7387567a63784250d29e274caa9717c4e95b42a8698a5c5d20'
AND (
token = 'HI8ACZNuX31btgWJQfE3BCXIoJ3oc48SyMU7uviR3tQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)