UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rr0OX61YPJxALXeLPyMIixNsN9ZQJDvl2HQWfAkvtqw='
WHERE
key_id = '89d367fcb5e8887a5ba834f7d348f7398ff940737e72e82f27b337578e0e5a22'
AND (
token = 'rr0OX61YPJxALXeLPyMIixNsN9ZQJDvl2HQWfAkvtqw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)