UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q7W5PxJWBDtOT9p1m8A0ivd83Tp8XzQ5VxZPc9PfK5o=' 
WHERE 
  key_id = '139ffa2272de0361aa75b1087e97e463b82145e9eeb7866fad0419334ee66737' 
  AND (
    token = 'Q7W5PxJWBDtOT9p1m8A0ivd83Tp8XzQ5VxZPc9PfK5o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033