UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'STo9Kpy5BWnTk7ZVIytG5qA3Fjmq6YY2sxgvho2nx18='
WHERE
key_id = '6c2be4190b67091055bb71e50934f75cd13cf28f4b3b92672724572d0a78e238'
AND (
token = 'STo9Kpy5BWnTk7ZVIytG5qA3Fjmq6YY2sxgvho2nx18='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)