UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RrN7URg8zFnjsyEIhUWB87Lmy2vGygOBDkbiiFr7yC0=' 
WHERE 
  key_id = '07117706e2181dc6b11077708edbf9367fc83f960ff0b3c24357adef3c4fbda7' 
  AND (
    token = 'RrN7URg8zFnjsyEIhUWB87Lmy2vGygOBDkbiiFr7yC0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030