UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6Y1jsH+6Rchs/19NNyDXlbZxRdBztf09DazSLs65fWU=' 
WHERE 
  key_id = '990e7412b808e463d135827de69da26ac9736a8c99b0388df985cb39ab8b1777' 
  AND (
    token = '6Y1jsH+6Rchs/19NNyDXlbZxRdBztf09DazSLs65fWU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063