UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1ctfA3aJtojpq/oXujxD1xzvhRIa66E4sWx76FroCaw=' 
WHERE 
  key_id = '8b945c86fb5fa9a1d3e804d465aa15d6d669b0bd53b093404bea984aba63af99' 
  AND (
    token = '1ctfA3aJtojpq/oXujxD1xzvhRIa66E4sWx76FroCaw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050