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