UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AiuwnQM/ssx4QxuOMZB3sEv+YLlkz8HBcFNx/q/x4w8='
WHERE
key_id = 'd7f082b06bf947b03ba67caa35c4679e820294bd224bf1d5e48f8ac132a3e11a'
AND (
token = 'AiuwnQM/ssx4QxuOMZB3sEv+YLlkz8HBcFNx/q/x4w8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)