UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3SaWPJpb+Azb2UQ68SElfBHuCRRCpNqe8lrp8XnjvV8='
WHERE
key_id = '9be7558b14c0bf924499670572df68d62e38119ae502fd1db53fb6c260c861d5'
AND (
token = '3SaWPJpb+Azb2UQ68SElfBHuCRRCpNqe8lrp8XnjvV8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)