UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ikpDTCH8pY1ir92n42BEgUiNBJtekMD7a2OVAk6SjZc='
WHERE
key_id = 'bb8624cd6ce5f8637ef3f4c1ae14781df27211885b03c85b892c396714aaec31'
AND (
token = 'ikpDTCH8pY1ir92n42BEgUiNBJtekMD7a2OVAk6SjZc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)