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