UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'afA2RXFIHAG/7jyhs7ey72neTV9EOpKgRDySe2+pU5I=' 
WHERE 
  key_id = 'a88b414f44a1e80228868ad26c858eca73156f7fe0104c202a506b641a4675d3' 
  AND (
    token = 'afA2RXFIHAG/7jyhs7ey72neTV9EOpKgRDySe2+pU5I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027