UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7NwhumiPBCaUrHgvYpW5cPYFBcobMIYX8WbB5ra8Zg8=' 
WHERE 
  key_id = 'c9e13d18b00650c0ebf052656f4791ce2b32833e9b773887f3781b23d8f08ad2' 
  AND (
    token = '7NwhumiPBCaUrHgvYpW5cPYFBcobMIYX8WbB5ra8Zg8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034