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

Query time 0.00037