UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sn0g8llH4P3NTbqwPrj9fXPJIesi/bmGHgjo280HZYw='
WHERE
key_id = '34fe74980dad6dd87d30f40c47eba36eb6b6b1fe121ffcb9f9ef4bcb4f79bc0d'
AND (
token = 'sn0g8llH4P3NTbqwPrj9fXPJIesi/bmGHgjo280HZYw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)