UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M/DcgnTQdklWYslW0cERaav1Q3sauG3cmS6Gw23zBg8='
WHERE
key_id = '34b85289e63465d8a4738c9ec43c2145c7b84a6d4be98d403facf349a86321d7'
AND (
token = 'M/DcgnTQdklWYslW0cERaav1Q3sauG3cmS6Gw23zBg8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)