UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7M+qFuVgCW7ZmMuumak33veuYZRJWKy73pkAecAOcpI=' 
WHERE 
  key_id = '7002c104ee774dc637dd11ec4327885388ea0069103a80585067a4c0cffe306d' 
  AND (
    token = '7M+qFuVgCW7ZmMuumak33veuYZRJWKy73pkAecAOcpI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023