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