UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vR0FZxP0rBxD1ane85Vri35JS2NWORGtWx1coFkl3fw=' 
WHERE 
  key_id = '80067c2a271801c3b80731b549993031e7cd0905d53fe9bbd20d7e3b49fdc0c1' 
  AND (
    token = 'vR0FZxP0rBxD1ane85Vri35JS2NWORGtWx1coFkl3fw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034