UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'waz9PoEYt9LPj497DUYe4y/biU0ZbC7LeYS+Yjnype8='
WHERE
key_id = '1dca521c259397a3fd13ca492e182ac3a47ec254731cfdee968993f947ef6735'
AND (
token = 'waz9PoEYt9LPj497DUYe4y/biU0ZbC7LeYS+Yjnype8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)